#include "stdafx.h"
#include <boost/test/auto_unit_test.hpp>
#include "detail/bmock_func_spec.hpp"
#include "bmock_util.hpp"

namespace bmock {
	static const std::string FUNCTION_NAME     = "func1";
	static const std::string RET_TYPE      = "int";
	static const int    VAL1          = 123;
	static const char   VAL2[]        = "ABVDEF";
	static       int    var1_;
	static       int   &var1 = var1_;;
	static       int   *var2;
	static       char  *var3;
#define ARGS_COUNT 5
	static const std::string   EXP_OUT = std::string(",OUT(") + out_arg_val::UNKNOWN + std::string(")");
	static const location LC(__FILE__,__LINE__);
	static const std::string   EXP_COMMON = FUNCTION_NAME
		+","+boost::lexical_cast<std::string>(LC)
		+","+boost::lexical_cast<std::string>(ARGS_COUNT)+",("
		+"IN(\""+boost::lexical_cast<std::string>(VAL1)+"\")"
		+",IN(\""+VAL2+"\")"
		+EXP_OUT
		+EXP_OUT
		+EXP_OUT
		+"));";
	__BMOCK_ARG_LIST(
		ARGS_COUNT
		,(IN(VAL1)
		,IN(VAL2)
		,OUT(var1)
		,OUT(var2)
		,OUT(var3))
		)

		static const arg_list args(args_,ARGS_COUNT);

	BOOST_AUTO_TEST_CASE(test_BMOCK_EXPECT) {
		const std::string    expected = "BMOCK_EXPECT_STR("+EXP_COMMON;
		const func_spec fs(FUNCTION_NAME,LC);
		std::string          result;

		BOOST_CHECK_NO_THROW(result = fs.message(args));
		BOOST_CHECK_EQUAL(expected,result);
	}

	BOOST_AUTO_TEST_CASE(test_BMOCK_EXPECT_RETURN) {
		const std::string    expected = "BMOCK_EXPECT_RETURN_STR("+RET_TYPE+','+EXP_COMMON;
		const func_spec fs(RET_TYPE,FUNCTION_NAME,LC);
		std::string          result;

		BOOST_CHECK_NO_THROW(result = fs.message(args));
		BOOST_CHECK_EQUAL(expected,result);
	}
}
